package com.example.demo.repository;

import com.example.demo.domain.Student;
import com.example.demo.domain.Teacher;
import org.hibernate.annotations.SQLUpdate;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface TeacherRespository extends JpaRepository<Teacher,Integer> {
    /**
     * 更新
     * 按工号查找并更新老师信息
     */
    @Query(nativeQuery = true,value="select * from tb_teacher t1 order by tid desc limit 1")
    List<Teacher> findLastestTeachers();

    /**
     * 通过tid找到老师信息
     * @param id
     * @return
     */
    Teacher findByTid(String id);
}
